﻿<metro:Window x:Class="Script.MainWindow"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:metro="http://schemas.codeplex.com/elysium"
              xmlns:params="http://schemas.codeplex.com/elysium/params"
              xmlns:common="clr-namespace:Apex.Common.GUI;assembly=Apex.Common.GUI"
              xmlns:script="clr-namespace:Apex.Script.ViewModels;assembly=Apex.Script"
              params:Manager.Theme="Dark" 
              params:Manager.AccentBrush="{x:Static metro:AccentBrushes.Red}" 
              params:Manager.ContrastBrush="White" 
              Title="APEX - Script" Background="{DynamicResource BackgroundBrush}"
              params:Window.MinimizeButtonToolTip="Minimize"
              params:Window.MaximizeButtonToolTip="Maximize"
              params:Window.RestoreButtonToolTip="Restore"
              params:Window.CloseButtonToolTip="Close"
              WindowStartupLocation="CenterScreen"
              DataContext="{Binding RelativeSource={RelativeSource Self}}"
              Width="960" Height="540">
    <metro:Window.Resources>
        <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
    </metro:Window.Resources>
    <metro:Window.TitleBar>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Column="1"
                    Content="?"
                    Style="{DynamicResource {x:Static metro:Window.DefaultCaptionButtonStyleKey}}"/>
        </Grid>
    </metro:Window.TitleBar>
    <DockPanel>
        <Menu IsMainMenu="True" DockPanel.Dock="Top" Background="{DynamicResource HighlightBrush}">
            <MenuItem Header="_File">
                <MenuItem Header="_New" >
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_page_code}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                    <MenuItem Header="Empty Script" />
                    <MenuItem Header="From Template" />
                </MenuItem>
                <MenuItem Header="_Open">
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_folder_open}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Open Recent" />
                <Separator />
                <MenuItem Header="_Save">
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_save}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="Save _As" />
                <MenuItem Header="Export Template">
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_clipboard_edit}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Header="_Close" />
                <Separator />
                <MenuItem Header="E_xit">
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_close}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="About">
                    <MenuItem.Icon>
                        <Rectangle Fill="{DynamicResource ForegroundBrush}" Width="8">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_information}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <Grid Margin="10,0,10,10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.25*" MinWidth="200" />
                <ColumnDefinition Width="0.75*"/>
            </Grid.ColumnDefinitions>

            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="35"/>
                    <RowDefinition Height="35"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="35"/>
                    <RowDefinition Height="35"/>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="Script Details" Style="{DynamicResource HeadingOneStyle}"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Edit Mode: "  VerticalAlignment="Center" Style="{DynamicResource HeadingTwoStyle}"/>
                        <TextBlock Text="{Binding IsChecked, ElementName=btnEditMode}" VerticalAlignment="Center" Style="{DynamicResource HeadingTwoStyle}"/>
                        <metro:ToggleSwitch Name="btnEditMode" Margin="20,0,0,0"/>
                    </StackPanel>
                </StackPanel>

                <TextBlock Grid.Row="1" Margin="0,0,10,0" Style="{StaticResource HeadingThreeStyle}" Text="{Binding CurrentScript.Name}" />

                <StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,0,10,0">
                    <TextBlock Text="Author: "  Style="{StaticResource HeadingThreeStyle}"/>
                    <TextBlock  Style="{StaticResource HeadingTwoStyle}" Text="{Binding CurrentScript.Author}" />
                </StackPanel>

                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Grid.Row="3" Margin="0,0,10,0">
                    <TextBlock Style="{StaticResource HeadingTwoStyle}" VerticalAlignment="Top" TextWrapping="Wrap" Text="{Binding CurrentScript.Description}" 
                               FontFamily="Courier New"/>
                </ScrollViewer>
                <TextBlock Grid.Row="5" Margin="0,0,10,0" Style="{StaticResource HeadingTwoStyle}" Text="{Binding CurrentScript.ProductionCompany}" />

                <TextBox Grid.Row="1" Margin="0,0,10,0" Text="{Binding CurrentScript.Name}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=btnEditMode}" />
                <TextBox Grid.Row="2" Margin="0,0,10,0" Text="{Binding CurrentScript.Author}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=btnEditMode}"/>
                <TextBox Grid.Row="3" Margin="0,0,10,0" FontFamily="Courier New" TextWrapping="Wrap" VerticalContentAlignment="Top" Text="{Binding CurrentScript.Description}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=btnEditMode}"/>

                <StackPanel Orientation="Horizontal" Grid.Row="4" Margin="0,0,10,0">
                    <TextBlock Text="Version: " Style="{StaticResource HeadingTwoStyle}"/>
                    <TextBlock  Style="{StaticResource HeadingTwoStyle}" Text="{Binding CurrentScript.Version}" />

                </StackPanel>

                <TextBox  Grid.Row="4" Margin="0,0,10,0" Text="{Binding CurrentScript.Version}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=btnEditMode}"/>

                <TextBox Grid.Row="5" Margin="0,0,10,0" Text="{Binding CurrentScript.ProductionCompany}" Visibility="{Binding IsChecked, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=btnEditMode}"/>

                <Button Name="btnCharacters" Content="Characters" Grid.Row="6" Margin="5,5,10,5" Click="btnCharacters_Click"/>
                <Button Name="btnLocations" Content="Locations" Grid.Row="7" Margin="5,5,10,5" Click="btnLocations_Click"/>
            </Grid>
            <GridSplitter Grid.RowSpan="9" ResizeBehavior="BasedOnAlignment" ResizeDirection="Columns" Width="1" Height="Auto" Margin="0" Background="{DynamicResource LowlightBrush}" />
            <Grid Name="pnlScript" Grid.Column="1" Margin="10,0,0,0">
                <Grid.Resources>
                    <DataTemplate DataType="{x:Type script:SequenceGroupViewModel}">
                        <Grid Width="200" Height="100" Margin="5">
                            <Rectangle Fill="{StaticResource HighlightBrush}" />
                            <Rectangle Fill="{x:Static metro:AccentBrushes.Red}" Height="4" VerticalAlignment="Top"/>
                            <TextBlock Text="{Binding Name}" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="5,5,0,0" VerticalAlignment="Top"/>
                            <Button Name="btnOpenContent" Tag="{Binding}" Content="Open" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Click="btnOpenContent_Click"/>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5">
                                <TextBlock Text="Subitems: " Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                                <TextBlock Text="{Binding Items.Count}" Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                    <DataTemplate DataType="{x:Type script:SequenceViewModel}">
                        <Grid Width="200" Height="100" Margin="5">
                            <Rectangle Fill="{StaticResource HighlightBrush}" />
                            <Rectangle Fill="{x:Static metro:AccentBrushes.Lime}" Height="4" VerticalAlignment="Top"/>
                            <TextBlock Text="{Binding Name}" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="5,5,0,0" VerticalAlignment="Top"/>
                            <Button Name="btnOpenContent" Tag="{Binding}" Content="Open" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Click="btnOpenContent_Click"/>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5">
                                <TextBlock Text="Subitems: " Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                                <TextBlock Text="{Binding Items.Count}" Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                    <DataTemplate DataType="{x:Type script:SceneViewModel}">
                        <Grid Height="250" Margin="5">
                            <Grid Width="350" Height="250" HorizontalAlignment="Left">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="17*"/>
                                    <ColumnDefinition Width="8*"/>
                                </Grid.ColumnDefinitions>
                                <Rectangle Fill="{StaticResource HighlightBrush}" Grid.ColumnSpan="2" />
                                <Rectangle Fill="{x:Static metro:AccentBrushes.Orange}" Height="4" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
                                <TextBlock Text="{Binding Name}" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="5,5,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
                                <ScrollViewer Margin="5,35,5,5" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{DynamicResource ForegroundBrush}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                    <TextBlock FontFamily="Courier New" TextWrapping="Wrap" Text="{Binding Description}" />
                                </ScrollViewer>
                                <Button Name="btnOpenContent" Tag="{Binding}" Click="btnOpenContent_Click" Grid.Column="1" Content="Open" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,10,10,5" Width="90"/>
                                <ToggleButton Name="btnCharacters" IsChecked="{Binding IsCharactersChecked}" Tag="{Binding}" Grid.Column="1" Content="Characters" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,45,10,5" Width="90"/>
                                <ToggleButton Name="btnLocation" IsChecked="{Binding IsLocationChecked}" Tag="{Binding}" Grid.Column="1" Content="Location" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,80,10,5" Width="90"/>
                                <Button Name="btnEdit" Tag="{Binding}" Grid.Column="1" Content="Edit" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5,115,10,5" Width="90"/>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,5,5" Grid.Column="1">
                                    <TextBlock Text="Subitems: " Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                                    <TextBlock Text="{Binding Items.Count}" Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                                </StackPanel>
                            </Grid>
                            <Grid Name="pnlCharacters" Visibility="{Binding IsCharactersChecked, Converter={StaticResource BooleanToVisibilityConverter}}" Height="230" Margin="350,0,0,0" Width="200" HorizontalAlignment="Left">
                                <Rectangle Fill="{StaticResource HighlightBrush}" Grid.ColumnSpan="2" />
                                <Rectangle Width="2" Fill="{x:Static metro:AccentBrushes.Orange}" HorizontalAlignment="Left" />
                                <TextBlock Text="Characters" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="10,5,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
                                <ListView Name="lvCharacters" Foreground="{StaticResource ForegroundBrush}" ItemsSource="{Binding Characters}" Margin="10,40,10,10" Background="Transparent" BorderBrush="{x:Null}">
                                    <ListView.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Name}" />
                                        </DataTemplate>
                                    </ListView.ItemTemplate>
                                </ListView>
                            </Grid>
                            <Grid Name="pnlLocations" TextElement.Foreground="{StaticResource ForegroundBrush}"
                                  Visibility="{Binding IsLocationChecked, Converter={StaticResource BooleanToVisibilityConverter}}" Height="230" Margin="350,0,0,0" Width="200" HorizontalAlignment="Left">
                                <Rectangle Fill="{StaticResource HighlightBrush}" Grid.ColumnSpan="2" />
                                <Rectangle Width="2" Fill="{x:Static metro:AccentBrushes.Orange}" HorizontalAlignment="Left" />
                                <TextBlock Text="Location" Style="{StaticResource HeadingOneStyle}" Margin="10,5,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
                                <Grid Margin="10,40,10,10">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="0.4*"/>
                                        <ColumnDefinition Width="0.6*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition />
                                    </Grid.RowDefinitions>

                                    <TextBlock Text="Name" Grid.Column="0" Grid.Row="0" />
                                    <TextBlock Text="Position" Grid.Column="0" Grid.Row="1" />
                                    <TextBlock Text="Weather" Grid.Column="0" Grid.Row="2" />
                                    <TextBlock Text="Time Of Day" Grid.Column="0" Grid.Row="3" />
                                    <TextBlock Text="Actual Date" Grid.Column="0" Grid.Row="4" />

                                    <TextBlock Text="{Binding Location.Name}" Grid.Column="1" Grid.Row="0" />
                                    <TextBlock Grid.Column="1" Grid.Row="1">
                                        <Hyperlink Name="btnGoToMap" Tag="{Binding Location}" Click="btnGoToMap_Click">
                                            See on map
                                        </Hyperlink>
                                    </TextBlock>
                                    <TextBlock Text="{Binding Location.Weather}" Grid.Column="1" Grid.Row="2" />
                                    <TextBlock Text="{Binding Location.TimeOfDay}" Grid.Column="1" Grid.Row="3" />
                                    <TextBlock Text="{Binding Location.ActualDate}" Grid.Column="1" Grid.Row="4" />
                                </Grid>
                            </Grid>
                        </Grid>

                    </DataTemplate>
                    <DataTemplate DataType="{x:Type script:SceneDescriptionViewModel}">
                        <Grid Width="250" Height="200" Margin="5">
                            <Rectangle Fill="{StaticResource HighlightBrush}" />
                            <Rectangle Fill="{x:Static metro:AccentBrushes.Mango}" Height="4" VerticalAlignment="Top"/>
                            <TextBlock Text="{Binding TreeDisplayText}" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="5,5,0,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
                            <ScrollViewer Margin="5,35,5,41" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{DynamicResource ForegroundBrush}" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                                <TextBlock FontFamily="Courier New" TextWrapping="Wrap" Text="{Binding Description}" />
                            </ScrollViewer>
                            <Button Name="btnEdit" Tag="{Binding}" Grid.Column="1" Content="Edit" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5,10,10,5" Width="90"/>
                        </Grid>
                    </DataTemplate>
                    <DataTemplate DataType="{x:Type script:SceneDialogueViewModel}">
                        <Grid Width="250" Height="200" Margin="5">
                            <Rectangle Fill="{StaticResource HighlightBrush}" />
                            <Rectangle Fill="{x:Static metro:AccentBrushes.Magenta}" Height="4" VerticalAlignment="Top"/>
                            <TextBlock Text="{Binding TreeDisplayText}" Foreground="{StaticResource ForegroundBrush}" Style="{StaticResource HeadingOneStyle}" Margin="5,5,0,0" VerticalAlignment="Top"/>

                            <ListView Name="lvDialogue" ItemsSource="{Binding Items}" Margin="5,35,5,41" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{DynamicResource ForegroundBrush}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Character.Name}" />
                                            <TextBlock Text=":" Margin="2,0,2,0" />
                                            <TextBlock Text="{Binding Line}" />
                                            <TextBlock Text="[" Margin="2,0,2,0" />
                                            <TextBlock Text="{Binding Directions}" />
                                            <TextBlock Text="]" Margin="2,0,2,0" />
                                        </StackPanel>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                            
                            <Button Name="btnEdit" Tag="{Binding}" Content="Edit" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Click="btnOpenContent_Click"/>
                            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5">
                                <TextBlock Text="Lines: " Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                                <TextBlock Text="{Binding Items.Count}" Style="{StaticResource HeadingTwoStyle}" Foreground="{StaticResource ForegroundBrush}"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </Grid.Resources>
                <Grid.RowDefinitions>
                    <RowDefinition Height="45"/>
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="0.25*" MaxWidth="500"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.ColumnSpan="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition />
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition Width="40" />
                        <ColumnDefinition Width="40" />
                    </Grid.ColumnDefinitions>
                    <metro:CommandButton Name="btnHome" Header="Back" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="0"
                                         Margin="0" Click="btnHome_Click">
                        <Rectangle Fill="{Binding Foreground, ElementName=btnHome}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_home}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                    <metro:CommandButton Name="btnBack" Header="Back" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="1"
                                         Margin="0" Click="btnBack_Click" IsEnabled="{Binding IsBackButtonEnabled}">
                        <Rectangle Fill="{Binding Foreground, ElementName=btnBack}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_arrow_left}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                    <metro:CommandButton Name="btnForward" Header="Forward" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="2"
                                         Margin="5,0,0,0" Click="btnForward_Click" IsEnabled="{Binding IsForwardButtonEnabled}">
                        <Rectangle Fill="{Binding Foreground, ElementName=btnForward}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_arrow_right}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                    <TextBlock Grid.Column="3" Text="{Binding Group}" DataContext="{Binding CurrentDataContext}" Style="{StaticResource ThingHeadingStyle}" VerticalAlignment="Center" Margin="15,-2,0,6"/>
                    <metro:CommandButton Name="btnAdd" Header="Add" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="4"
                                         Margin="5,0,0,0" Click="btnAdd_Click" >
                        <Rectangle Fill="{Binding Foreground, ElementName=btnAdd}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_add}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                    <metro:CommandButton Name="btnEdit" Header="Edit" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="5"
                                         Margin="5,0,0,0" Click="btnEdit_Click" >
                        <Rectangle Fill="{Binding Foreground, ElementName=btnEdit}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_edit}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                    <metro:CommandButton Name="btnRemove" Header="Remove" Width="30" Height="30" VerticalAlignment="Center" Grid.Column="6"
                                         Margin="5,0,0,0" Click="btnRemove_Click" >
                        <Rectangle Fill="{Binding Foreground, ElementName=btnRemove}" Width="15" Height="14">
                            <Rectangle.OpacityMask>
                                <VisualBrush Visual="{StaticResource appbar_delete}"/>
                            </Rectangle.OpacityMask>
                        </Rectangle>
                    </metro:CommandButton>
                </Grid>

                <ListView Name="lvMainView" ItemsSource="{Binding Items}" DataContext="{Binding CurrentDataContext}" Grid.Row="1" Grid.Column="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Background="{x:Null}" BorderBrush="{x:Null}">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                    <ListView.ContextMenu>
                        <ContextMenu>
                            <MenuItem Header="Add" />
                            <MenuItem Header="Edit" />
                            <MenuItem Header="Remove" />
                        </ContextMenu>
                    </ListView.ContextMenu>
                </ListView>

                <TextBlock Text="Quick Nav" Style="{StaticResource HeadingThreeStyle}" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Center"/>
                <TreeView Name="tvQuickNav" ItemsSource="{Binding Items}" DataContext="{Binding CurrentScript}" Grid.Column="1" Grid.Row="1" Margin="0,30,0,0" Background="{x:Null}" BorderBrush="{x:Null}"
                          Foreground="{DynamicResource ForegroundBrush}">
                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Path=Items}">
                            <TextBlock Margin="5,0,0,0" Text="{Binding Path=TreeDisplayText}" Foreground="{Binding Foreground, ElementName=tvQuickNav}" FontSize="16" FontWeight="Light" VerticalAlignment="Center"/>
                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>

                </TreeView>

                <GridSplitter Grid.Row="1" ResizeBehavior="BasedOnAlignment" ResizeDirection="Columns" Width="1" Height="Auto" Margin="0" Background="{DynamicResource LowlightBrush}" />
            </Grid>
        </Grid>
    </DockPanel>
</metro:Window>
